<template>
  <el-select v-model="cur_value" placeholder="请选择上司" clearable>
    <el-option
      v-for="item in bossAry"
      :key="'bossAry' + item.id"
      :label="item.name"
      :value="item.id"
    />
  </el-select> 
</template>

<script>
import {
  getBoss
} from "@/api/org_team_members";
export default {
  name: "bossSelect",
  props: {
    value: [String,Number],
  },
  data() {
    return {
      bossAry: [],
    };
  },
  computed: {
    cur_value: {
      get() {
        return this.value;
      },
      set(val) {
        this.$emit("change", val);
      },
    },
  },
  created() {
    this.initBoss();
  },
  methods: {
    initBoss() {
      return getBoss().then((response) => {
        console.log(response);
        var data = response.data;  
        data.unshift({id:0,name:'无'})
        this.bossAry = data;       
      });
    },
  },
};
</script>

